home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / wait.man < prev    next >
Encoding:
Text File  |  1989-01-01  |  4.4 KB  |  133 lines

  1.  
  2.  
  3.  
  4. WAIT                  C Library Procedures                   WAIT
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      wait, wait3 - wait for process to terminate
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ##iinncclluuddee <<ssyyss//wwaaiitt..hh>>
  13.  
  14.      ppiidd == wwaaiitt((ssttaattuuss))
  15.      iinntt ppiidd;;
  16.      uunniioonn wwaaiitt **ssttaattuuss;;
  17.  
  18.      ppiidd == wwaaiitt((00))
  19.      iinntt ppiidd;;
  20.  
  21.      ##iinncclluuddee <<ssyyss//ttiimmee..hh>>
  22.      ##iinncclluuddee <<ssyyss//rreessoouurrccee..hh>>
  23.  
  24.      ppiidd == wwaaiitt33((ssttaattuuss,, ooppttiioonnss,, rruussaaggee))
  25.      iinntt ppiidd;;
  26.      uunniioonn wwaaiitt **ssttaattuuss;;
  27.      iinntt ooppttiioonnss;;
  28.      ssttrruucctt rruussaaggee **rruussaaggee;;
  29.  
  30. DDEESSCCRRIIPPTTIIOONN
  31.      _W_a_i_t causes its caller to delay until a signal is received
  32.      or one of its child processes terminates.  If any child has
  33.      died since the last _w_a_i_t, return is immediate, returning the
  34.      process id and exit status of one of the terminated chil-
  35.      dren.  If there are no children, return is immediate with
  36.      the value -1 returned.
  37.  
  38.      On return from a successful _w_a_i_t call, _s_t_a_t_u_s is nonzero,
  39.      and the high byte of _s_t_a_t_u_s contains the low byte of the
  40.      argument to _e_x_i_t supplied by the child process; the low byte
  41.      of _s_t_a_t_u_s contains the termination status of the process.  A
  42.      more precise definition of the _s_t_a_t_u_s word is given in
  43.      <_s_y_s/_w_a_i_t._h>.
  44.  
  45.      _W_a_i_t_3 provides an alternate interface for programs that must
  46.      not block when collecting the status of child processes.
  47.      The _s_t_a_t_u_s parameter is defined as above.  The _o_p_t_i_o_n_s
  48.      parameter is used to indicate the call should not block if
  49.      there are no processes that wish to report status (WNOHANG),
  50.      and/or that children of the current process that are stopped
  51.      due to a SIGTTIN, SIGTTOU, SIGTSTP, or SIGSTOP signal should
  52.      also have their status reported (WUNTRACED).  If _r_u_s_a_g_e is
  53.      non-zero, a summary of the resources used by the terminated
  54.      process and all its children is returned (this information
  55.      is currently not available for stopped processes).
  56.  
  57.      When the WNOHANG option is specified and no processes wish
  58.      to report status, _w_a_i_t_3 returns a _p_i_d of 0.  The WNOHANG and
  59.      WUNTRACED options may be combined by _o_r'ing the two values.
  60.  
  61.  
  62.  
  63. Sprite v1.0               June 30, 1985                         1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. WAIT                  C Library Procedures                   WAIT
  71.  
  72.  
  73.  
  74. NNOOTTEESS
  75.      See _s_i_g_v_e_c(2) for a list of termination statuses (signals);
  76.      0 status indicates normal termination.  A special status
  77.      (0177) is returned for a stopped process that has not ter-
  78.      minated and can be restarted; see _p_t_r_a_c_e(2).  If the 0200
  79.      bit of the termination status is set, a core image of the
  80.      process was produced by the system.
  81.  
  82.      If the parent process terminates without waiting on its
  83.      children, the initialization process (process ID = 1) inher-
  84.      its the children.
  85.  
  86.      _W_a_i_t and _w_a_i_t_3 are automatically restarted when a process
  87.      receives a signal while awaiting termination of a child pro-
  88.      cess.
  89.  
  90. RREETTUURRNN VVAALLUUEE
  91.      If _w_a_i_t returns due to a stopped or terminated child pro-
  92.      cess, the process ID of the child is returned to the calling
  93.      process.  Otherwise, a value of -1 is returned and _e_r_r_n_o is
  94.      set to indicate the error.
  95.  
  96.      _W_a_i_t_3 returns -1 if there are no children not previously
  97.      waited for;  0 is returned if WNOHANG is specified and there
  98.      are no stopped or exited children.
  99.  
  100. EERRRROORRSS
  101.      _W_a_i_t will fail and return immediately if one or more of the
  102.      following are true:
  103.  
  104.      [ECHILD]       The calling process has no existing
  105.                     unwaited-for child processes.
  106.  
  107.      [EFAULT]       The _s_t_a_t_u_s or _r_u_s_a_g_e arguments point to an
  108.                     illegal address.
  109.  
  110. SSEEEE AALLSSOO
  111.      exit(2)
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0               June 30, 1985                         2
  130.  
  131.  
  132.  
  133.